package com.future.cor.v2;

/**
 * Description:
 *
 * @author weiruibai.vendor
 * Date: 2022/2/21 18:03
 */
public interface MyFilter {

    void doFilter(Request request, Response response, MyFilterChain filterChain);
}


class Filter1 implements MyFilter {

    int value = 100;

    @Override
    public void doFilter(Request request, Response response, MyFilterChain filterChain) {
        request.paths.add(this.getClass().getName());
        filterChain.doFilter(request, response);
        response.paths.add(this.getClass().getName());
        response.sum += value;
    }
}

class Filter2 implements MyFilter {

    int value = 50;

    @Override
    public void doFilter(Request request, Response response, MyFilterChain filterChain) {
        request.paths.add(this.getClass().getName());
        filterChain.doFilter(request, response);
        response.paths.add(this.getClass().getName());
        response.sum += value;
    }
}

class Filter3 implements MyFilter {

    int value = 10;

    @Override
    public void doFilter(Request request, Response response, MyFilterChain filterChain) {
        request.paths.add(this.getClass().getName());
        filterChain.doFilter(request, response);
        response.paths.add(this.getClass().getName());
        response.sum += value;
    }
}

class Filter4 implements MyFilter {

    int value = 6;

    @Override
    public void doFilter(Request request, Response response, MyFilterChain filterChain) {
        request.paths.add(this.getClass().getName());
        filterChain.doFilter(request, response);
        response.paths.add(this.getClass().getName());
        response.sum += value;
    }
}